package com.scanner.scannersdk.callback;

import android.os.Parcel;
import android.os.Parcelable;

public class SdkMessage implements Parcelable {
    public final String message;
    public final int type;
    public byte[]s;
    public int[]t;
    public static SdkMessage getInstance(String message, int type, byte[]s) {
        return new SdkMessage(message,type,s);
    }

    public static SdkMessage getInstanceInt(String message, int type, int[]s) {
        return new SdkMessage(message,type,s);
    }

    private SdkMessage(String message, int type, byte[]s) {
        this.message = message;
        this.type=type;
        this.s=s;
    }

    private SdkMessage(String message, int type, int[]s) {
        this.message = message;
        this.type=type;
        this.t=s;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.message);
        dest.writeInt(this.type);
        dest.writeByteArray(this.s);
        dest.writeIntArray(this.t);
    }

    protected SdkMessage(Parcel in) {
        this.message = in.readString();
        this.type = in.readInt();
        this.s = in.createByteArray();
        this.t = in.createIntArray();
    }

    public static final Parcelable.Creator<SdkMessage> CREATOR = new Parcelable.Creator<SdkMessage>() {
        @Override
        public SdkMessage createFromParcel(Parcel source) {
            return new SdkMessage(source);
        }

        @Override
        public SdkMessage[] newArray(int size) {
            return new SdkMessage[size];
        }
    };
}
